#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>


int main()
{
    int arr[5] = {34, 67, 78,89,455};
    int len = sizeof(arr) / sizeof(arr[0]);

    //查找算法
    int find = 455;
    int left = 0;
    int right = len - 1;
    int mid = 0;
    bool flag = false;
    while (left <= right) {
        int mid = (left + right) / 2;
        
        if(arr[mid] > find){
            //向左查找
            right = mid - 1;
        }else if(arr[mid] < find){
            //向右查找
            left = mid + 1;
        }else{
            //找到
            flag = true;
            break;
        }
    }

    if(flag){
        printf("找到了\n");
    }else{
        printf("没有找到\n");
    }


    return 0;
}